#include <bits/stdc++.h>
using namespace std;
struct ListNode
{
    int val;
    ListNode *next;
};
class Solution

{
public:
    ListNode* FindFirstCommonNode( ListNode* pHead1, ListNode* pHead2)
	{
		ListNode* p = pHead1;
		ListNode* q = pHead2;
		while (q != p)
		{ 
			p = p ? p->next : pHead2;
			q = q ? q->next : pHead1;
		}
		return p;
    }
};
//相当于把两个串放到一起，两个指针相遇的地方就是它们的第一个公共结点